<template>
  <div class="detail">
    <header>欢迎来到商品详情页</header>
    <!-- <div class="xq-nav-ab">
          <div>商品</div>
          <div>评价</div>
          <div>详情</div>
          <div>推荐</div>
    </div> -->
    <div class="content">
      <img :src="product.coverImg" alt="图片" />
      <h1>{{ product.name }}</h1>
      <h2>￥{{ product.price / 100 }}</h2>

      <div class=" xq-main-f">
        <img
          src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/product/ranklist_logo.png"
          alt=""
        />
        <span
          >{{ $route.query.name }}热销榜第{{
            Math.floor(Math.random() * 10 + 1)
          }}名</span
        >
        <img
          style="margin-left:80px"
          src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/product/ranklist_icon.png"
          alt=""
        />
      </div>
      <div class=" xq-main-i" style="  position: relative;">
        <p>
          <span style="font-weight: 600;margin:0;color:#333;">已选</span>
          <span>1件</span>
        </p>
        <img
          style=" position: absolute; right:0px;"
          src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/product/ranklist_icon.png"
          alt=""
        />
      </div>
      <p
        slass=" xq-main-x"
        style="border-top: 1px solid #999999; width: 70%;z-index:9;height:1px;margin:0 0 0 20%"
      ></p>
      <div
        class=" xq-main-i xq-main-j"
        style="  position: relative; height:60px; margin:0 0 0 3.5%;"
      >
        <p>
          <span style="font-weight: 600;;color:#333;margin:0 ">送至</span>
          <span>河南河南省郑州市</span>
        </p>
        <img
          style=" position: absolute; right:0px;"
          src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/product/ranklist_icon.png"
          alt=""
        />
      </div>
      <div class="  xq-main-g">
        <div class="  xq-main-h">
          <img
            style="width:16px;height:16px; margin-left:10px;margin-top:18px"
            src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/icons/icon_checkbox_check_pale_brown.png"
            alt=""
          />
          <span style="font-size:11px">满99包邮</span>
          <img
            style="width:16px;height:16px; margin-left:10px;margin-top:18px"
            src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/icons/icon_checkbox_check_pale_brown.png"
            alt=""
          />
          <span style="font-size:11px">第三方店铺</span>
          <img
            style="width:16px;height:16px; margin-left:10px;margin-top:18px"
            src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/icons/icon_checkbox_check_pale_brown.png"
            alt=""
          />
          <span style="font-size:11px">7天无理由</span>
          <img
            style="width:16px;height:16px; margin-left:10px;margin-top:18px"
            src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/icons/icon_checkbox_check_pale_brown.png"
            alt=""
          />
          <span style="font-size:11px">售后免邮</span>
          <img
            style=" position: absolute; right:10px; width:32px;height:32px ;top:10px"
            src="https://m.xiaomiyoupin.com/youpin/static/m/res/images/product/ranklist_icon.png"
            alt=""
          />
        </div>
      </div>
      <div class="contentImg" v-html="product.content"></div>
    </div>
    <!-- 底部栏    -->
    <footer>
      <van-goods-action>
        <van-goods-action-icon icon="chat-o" text="客服" dot />
        <router-link to="/shopcar"
          ><van-goods-action-icon icon="cart-o" text="购物车" badge="0"
        /></router-link>
        <van-goods-action-icon icon="shop-o" text="店铺" badge="0" />
        <van-goods-action-button
          type="warning"
          @click="buy"
          text="加入购物车"
        />
        <van-goods-action-button
          type="danger"
          @click="buyOrder"
          text="立即购买"
        />
      </van-goods-action>
    </footer>
  </div>
</template>

<script>
import { loadProductDetail } from "../../api/products";
export default {
  name: "Detail",
  data() {
    return {
      count: "",
      product: {}, //该商品
      cartList: [], //购物车列表
    };
  },
  computed: {},
  watch: {
    $route() {
      this.loadData();
    },
  },
  methods: {
    buy() {},

    buyOrder() {},
  },
  async created() {
    //  loadData() {
    // if (this.$route.query.id) {
    const result = await loadProductDetail(this.$route.query.id);
    this.product = result;
    // }
    // }

    // this.loadData();
  },
  mounted() {},
  beforeCreate() {},
  beforeMount() {},
  beforeUpdate() {},
  updated() {},
  beforeDestroy() {},
  destroyed() {},
  activated() {},
};
</script>
<style lang="scss" scoped>
.detail {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: white;
  position: relative;

  header {
    background: fuchsia;
    position: fixed;
    width: 100%;
    height: 60px;
    top: 0;
    font-size: 2rem;
    color: whitesmoke;
    text-align: center;
    line-height: 60px;
  }
  .content {
    flex: 1;
    overflow: auto;
    img {
      width: 100%;
      height: 300px;
      display: block;
    }
  }
  // //   .xq-nav-ab {
  // //     position: absolute;
  // //     top: 60px;
  // //   width: 60%;
  // //   display: flex;
  // //   margin: 10px auto;
  // // }
  // .xq-nav-ab > div {
  //   width: 25%;
  //   line-height: 44px;
  // }
  .xq-main-f {
    width: 93%;
    height: 50px;
    margin-top: 30px;
    margin-left: 3.5%;
    background-color: rgb(255, 248, 237);
    display: flex;
  }
  .xq-main-f > img {
    width: 32px;
    height: 32px;
    margin-top: 10px;
  }
  .xq-main-f > span {
    display: block;
    line-height: 55px;
    width: 200px;
    height: 50px;
    margin-left: 10px;
  }
  .xq-main-i {
    width: 93%;
    height: 50px;
    margin-top: 30px;
    margin-left: 3.5%;
    font-size: 14px;
    display: flex;
  }
  .xq-main-i span {
    margin-left: 40px;
  }
  .xq-main-i > img {
    width: 32px;
    height: 32px;
    margin-top: 10px;
  }
  .xq-main-g {
    width: 100%;
    height: 50px;
    background: #eee;
  }
  .xq-main-h {
    line-height: 50px;
    position: relative;
    display: flex;
  }

  h1 {
    width: 99%;
    height: 80px;
    // border: 1px solid#000;
    margin: 20px auto;
    font-size: 1.6rem;
    line-height: 40px;
  }
  h2 {
    font-size: 2rem;
    color: deeppink;
  }
  footer {
    position: fixed;
    bottom: 0;
    height: 300px;

    .van-goods-action {
      height: 60px;
      //  background: dimgray;
      .van-button {
        height: 60px;
        font-size: 1.2rem;
      }
    }
  }
}
</style>
<style lang="scss">
.contentImg {
  width: 100%;
}
.contentImg img {
  width: 100%;
}
</style>
